package com.minelx.woods.task.common;

import com.minelx.table.core.series.source.Source;

import java.util.List;
import java.util.stream.Stream;

public class ListSource<R> implements Source<R> {
	private final List<R> list;

	public ListSource(List<R> list) {
		this.list = list;
	}

	@Override
	public R at(long l) {
		return list.get((int) l);
	}

	@Override
	public long len() {
		return list.size();
	}

	@Override
	public Stream<R> stream() {
		return list.stream();
	}
}
